
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'ListView: WinControl' { ... };

----------------------------------------------------------------------------------
-- func: ListView.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function ListView.__init__( self )
    WinControl.__init__( self );
end


----------------------------------------------------------------------------------
-- func: ListView:Create
-- desc: Creates a new listview object.
----------------------------------------------------------------------------------
function ListView:Create( parent )
    if parent == nil or parent._object == nil then
        slimui:err( 'ListView:Create - parent must be set to create a control!' );
    end

    self._object = createListView( parent._object );

    if self._object == nil then
        slimui:err( 'ListView:Create - failed to initialize a new object.' );
    end

    return self;
end

----------------------------------------------------------------------------------
-- func: ListView:Clear
-- desc: Clears the current items in this listview object.
----------------------------------------------------------------------------------
function ListView:Clear( )
    listview_clear( self._object );
end

----------------------------------------------------------------------------------
-- func: ListView:GetColumns
-- desc: Returns this listview objects columns.
----------------------------------------------------------------------------------
function ListView:GetColumns( )
    return listview_getColumns( self._object );
end

----------------------------------------------------------------------------------
-- func: ListView:GetItems
-- desc: Returns the items of this listview object.
----------------------------------------------------------------------------------
function ListView:GetItems( )
    return listview_getItems( self._object );
end

----------------------------------------------------------------------------------
-- func: ListView:GetItemIndex
-- desc: Returns the item index of this listview object.
----------------------------------------------------------------------------------
function ListView:GetItemIndex( )
    return listview_getItemIndex( self._object );
end

----------------------------------------------------------------------------------
-- func: ListView:SetItemIndex
-- desc: Sets the item index of this listview object.
----------------------------------------------------------------------------------
function ListView:SetItemIndex( index )
    listview_setItemIndex( self._object, index );
end

----------------------------------------------------------------------------------
-- func: ListView:GetCanvas
-- desc: Returns the canvas of this listview object.
----------------------------------------------------------------------------------
function ListView:GetCanvas( )
    return listview_getCanvas( self._object );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) listview.lua successfully loaded.' );
end